﻿using Sundry.IBLL;
using Sundry.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Sundry.BLL
{
    public class AdminMenuService : BaseService<AdminMenu>, IAdminMenuService
    {
        public override void SetCurrentRepository()
        {
            CurrentRepository = _dbSession.AdminMenuRepository;
        }
        /// <summary>
        /// 获取管理员显示菜单列表
        /// </summary>
        /// <typeparam name="S">排序类型</typeparam>
        /// <param name="whereLamda">查询条件</param>
        /// <param name="orderLamda">首次排序条件</param>
        /// <param name="thOrderLamda">再次排序条件</param>
        /// <param name="selector">查询结果字段</param>
        /// <returns>管理员显示菜单列表</returns>
        public IQueryable<F> GetAdminMenu<S,F>(Expression<Func<AdminMenu, bool>> whereLamda, Expression<Func<AdminMenu, S>> orderLamda, Expression<Func<AdminMenu, S>> thOrderLamda, Expression<Func<AdminMenu, F>> selector)
        {
            return _dbSession.AdminMenuRepository.GetAdminMenu<S,F>(whereLamda, orderLamda, thOrderLamda, selector);
        }
        /// <summary>
        /// 获取管理员显示菜单列表
        /// </summary>
        /// <typeparam name="S"></typeparam>
        /// <typeparam name="F"></typeparam>
        /// <param name="whereLamdaList">查询条件</param>
        /// <param name="orderLamdaDic">排序列表</param>
        /// <param name="startNum">起始数字</param>
        /// <param name="pageSize">长度</param>
        /// <param name="rowCount">总数目</param>
        /// <returns></returns>
        public IQueryable<dynamic> GetAdminMenu<S>(IEnumerable<Expression<Func<AdminMenu, bool>>> whereLamdaList, Dictionary<Expression<Func<AdminMenu, S>>, bool> orderLamdaDic, int startNum, int pageSize, out int rowCount) {
            return _dbSession.AdminMenuRepository.GetAdminMenu<S>(whereLamdaList, orderLamdaDic, startNum, pageSize, out rowCount);
        }
    }
}
